<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <fmt:setBundle basename="ApplicationMessage" />
  <fmt:setLocale value="zh_CN" />

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  <link href="${ctx.resource}/css/select2.css" rel="stylesheet">
  <link href="${ctx.resource}/css/select2-bootstrap.css" rel="stylesheet">
  <title>支付应用 - 租房宝金融管理平台</title>
  
</head>
<body>

  <%@ include file="/WEB-INF/include/header.jsp"%>

  <div class="web-g-main">

	<%@ include file="/WEB-INF/include/aside.jsp"%>
	
    <div class="content">
    
    	 <header class="header clearfix">
         	 <div class="row">
             	<div class="col-md-2">支付应用</div>
             	<div class="col-md-2 col-md-offset-8">
             		<a href="${ctx}/particalsystem/partical-details/" class="btn btn-default btn-shadow btn-shadow-default demo2do-btn"  title="添加"><i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;添加应用</a>
             	</div>
         	 
         	 </div>
          </header>
          
          <c:if test="${not empty infoMessage}">
            <div class="alert alert-success alert-dismissable alert-fade top-margin-10 text-align-center">
              <button type="button" class="close" data-dismiss="alert">&times;</button>
              <i class="glyphicon glyphicon-info-sign"></i>&nbsp;&nbsp;
              <fmt:message key="${infoMessage}" />
            </div>
          </c:if>

      <div class="panel-body">

        <div class="col-xs-12 earth-panel-layout-right">
          
          <table class="table table-striped demo2do-table bottom-margin-20">
            <thead>
              <tr>
                <th>序号</th>
                <th>支付应用</th>
                <th>应用地址</th>
                <th>应用类型</th>
                <th>应用状态</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
              <c:forEach var="partical" items="${particalList}" varStatus="status">
                <tr>
                  <td>${status.index + 1}</td>
                  <td>${partical.particalName}</td>
                  <td>${partical.entryUrl}</td>
                  <td><fmt:message key="${partical.particalType.key}"/></td>
                  <td><fmt:message key="${partical.particalStatus.key}"/></td>
                  <td>
                    <a href="${ctx}/particalsystem/partical-details/?particalUniqueId=${partical.uniqueParticalId }" class="hover-no-text-decoration" >编辑</a>&nbsp;
                    <a href="javascript:void(0)" data = "${partical.uniqueParticalId  }" class="hover-no-text-decoration delete-particcal" >删除</a>&nbsp;                                                    
                  </td>
                </tr>
              </c:forEach>
            </tbody>
          </table>
          
        </div><!-- layout right -->

      </div><!-- panel body -->
      
      <%@ include file="/WEB-INF/include/footer.jsp"%>
      
    </div><!-- panel layout -->
    
  </div><!-- main content -->
  
  <!-- dialog begin -->
  <div class="modal fade in bs-example-modal-sm" id="dialog" role="dialog" tabindex="-1" aria-labelledby="dialoglabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="关闭"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title" id="dialoglabel">提示</h4>
			</div>
			<div class="modal-body">
				<p></p>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default close-dialog" data-dismiss="modal">关闭</button>
			</div>
		</div>
	</div>
  </div><!-- dialog end -->
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <script src="${ctx.resource}/js/bootstrap-switch.min.js"></script>
  <script src="${ctx.resource}/js/bootstrap-modal-trigger.js"></script>
  <script src="${ctx.resource}/js/bootstrap.validate.js"></script>
  <script src="${ctx.resource}/js/bootstrap.validate.en.js"></script>
  <script src="${ctx.resource}/js/bootstrap-alert-fade-trigger.js"></script>
  <script type="text/javascript">
  	$(function(){
  		
	  	$(".delete-particcal").click(function(){
	  		
	  		var $this = $(this);
	  		var uniqueParticalId = $this.attr("data");
	  		$.post('${ctx}/particalsystem/delete-partical',
			  		{
	  					particalUniqueId:uniqueParticalId
			  		}).done(function(data){
			  			var jsonData = $.parseJSON(data);
							$("#dialog").find("p").text(jsonData.message).end().modal();
							setTimeout(function(){
								window.location.reload();
							},3000)
			  		})
	  		
	  	});
	  	
  	});
  </script>
</body>
</html>
